package top.huhuiyu.springbootmybatisbase.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import top.huhuiyu.springbootmybatisbase.model.PageInfoModel;
import top.huhuiyu.springbootmybatisbase.service.PageInfoService;
import top.huhuiyu.springbootmybatisbase.utils.JsonMessage;

/**
 * TbPageInfo
 * @author Aiden Pearce
 *
 */
@RestController
@RequestMapping("/pageinfo")
public class PageInfoController {
  
  @Autowired
  private PageInfoService pageInfoService;
  
  /**
   * -查询全部
   * @param model数据模型
   * @return json数据
   * @throws Exception 处理异常
   */
  @RequestMapping("/queryAll")
 public JsonMessage queryAll(PageInfoModel model)throws Exception {
   return pageInfoService.queryAll(model);
 }
 
 /**
  * -修改
   * @param model数据模型
   * @return json数据
   * @throws Exception 处理异常
  */
 @RequestMapping("/update")
 public JsonMessage update(PageInfoModel model)throws Exception {
   return pageInfoService.update(model);
 }
 
 /**
  *  -主键查询
   * @param model数据模型
   * @return json数据
   * @throws Exception 处理异常
  */
 @RequestMapping("/queryByKey")
 public JsonMessage queryByKey(PageInfoModel model)throws Exception {
   return pageInfoService.queryByKey(model);
 }
 
 /**
  * -删除
   * @param model数据模型
   * @return json数据
   * @throws Exception 处理异常
  */
 @RequestMapping("/delete")
 public JsonMessage delete(PageInfoModel model)throws Exception {
   return pageInfoService.delete(model);
 }
 
 /**
  * -添加
   * @param model数据模型
   * @return json数据
   * @throws Exception 处理异常
  */
 @RequestMapping("/add")
 public JsonMessage add(PageInfoModel model)throws Exception {
   //http://127.0.0.1:20000/pageinfo/add?title=oo&info=pp&tel=99&copyrigth=88&comname=66
   return pageInfoService.add(model);
 }

}
